package pattern.socketimpl;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * <p>
 * 服务器定时推送任务
 * </p>
 */
@Slf4j
@Component
public class ServerTask {

    @Autowired
    private SimpMessagingTemplate wsTemplate;

    /**
     * 按照标准时间来算，每隔 2s 执行一次
     */
    @Scheduled(cron = "0/10 * * * * ?")
    public void websocket() {
//        wsTemplate.convertAndSend(WebSocketConstant.SESSION_PUSH_SERVER, DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN));
    }
}
